import React, { memo } from "react";
import { MyMusicPage } from "./style";
import MyMusicLeft from "./MyMusicLeft";
import { renderRoutes } from "react-router-config";

export default memo(function myMusic(props) {
  const { route } = props;

  const isLogin = JSON.parse(window.localStorage.getItem("userInfo")).data
    ? JSON.parse(window.localStorage.getItem("userInfo")).data.account
    : "";

  document.title = `网易云音乐`;

  return (
    <MyMusicPage>
      {isLogin ? (
        <div className="myMusic wrap-v2">
          <MyMusicLeft />
          {renderRoutes(route.routes)}
        </div>
      ) : (
        <div className="n-msuic">
          <a href="#" className="btn">
            立即登录
          </a>
        </div>
      )}
    </MyMusicPage>
  );
});
